home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / XAMPP 1.4.14 / xampp-win32-1.4.14-installer.exe / xampp / install / install.php < prev    next >
PHP Script  |  2005-06-10  |  22KB  |  926 lines

  1. <?php
  2.  
  3. /* 
  4. #### Installer PHP  1.4 RC2  #### 
  5. #### Author: Kay Vogelgesang for www.apachefriends.org 2004 ####  
  6. */    
  7.  
  8. print "\r\n  ########################################################################\n
  9.   # ApacheFriends XAMPP setup win32 Version 1.4                          #\r\n
  10.   #----------------------------------------------------------------------#\r\n
  11.   # Copyright (c) 2002-2004 Apachefriends                                #\r\n
  12.   #----------------------------------------------------------------------#\r\n
  13.   # Authors: Kay Vogelgesang <kvo@apachefriends.org>                     #\r\n
  14.   #          Oswald Kai Seidler <oswald@apachefriends.org>               #\r\n
  15.   ########################################################################\r\n\r\n"; 
  16.  
  17. /// Where I stand? ///
  18. $curdir = getcwd();
  19. list ($partition, $nonpartition) = split (':', $curdir);
  20. list ($partwampp, $directorwampp) = spliti ('\\\install', $curdir);
  21. $awkpart = eregi_replace ("\\\\","\\\\",$partwampp);
  22. $awkpartslash = ereg_replace ("\\\\","/",$partwampp);
  23. $phpdir = $partwampp;
  24. $dir = ereg_replace ("\\\\","/",$partwampp);
  25. $ppartition="$partition:";
  26.  
  27. /// I need the install.sys + update.sys for more xampp informations
  28. $installsys="install.sys";
  29. $installsysroot=$partwampp."\install\\".$installsys;
  30.  
  31. /// Some addon|update.sys files 
  32. $perlupdatesys="perlupdate.sys";
  33. $pythonupdatesys="pythonupdate.sys";
  34. $serverupdatesys="serverupdate.sys";
  35. $utilsupdatesys="utilsupdate.sys";
  36. $javaupdatesys="javaupdate.sys";
  37. $otherupdatesys="otherupdate.sys";
  38.  
  39.  
  40. /// XAMPP main directrory is ... 
  41. $substit="\\\\\\\\xampp";
  42. $substitslash="/xampp";
  43.  
  44. /// Globale variables
  45. global $BS; 
  46. $BS = 0;
  47. global $CS; 
  48. $CS = 0;
  49. global $slashi;
  50. $slashi=1;
  51. global $bslashi;
  52. $bslashi=1;
  53. $awkexe=".\install\awk.exe";
  54. $awk=".\install\config.awk";
  55. // $awkexe="$partwampp\install\awk.exe";
  56. // $awk="$partwampp\install\config.awk";
  57. $awknewdir="\"".$awkpart."\"";
  58. $awkslashdir="\"".$awkpartslash."\"";
  59. global $xamppversion;
  60. if (file_exists("$partwampp\install\.version")) 
  61. { include_once("$partwampp\install\.version"); }
  62. $confhttpdroot=$partwampp."\apache\\conf\\httpd.conf";
  63. $confhttpd2root=$partwampp."\php\\php4\\httpd4.conf";
  64. $confhttpd3root=$partwampp."\php\\httpd5.conf";
  65.  
  66.  
  67. // Find the install status for xampp basic package in the install.sys file
  68. if (file_exists($installsysroot)) 
  69. {
  70. $i=0;
  71. $datei = fopen($installsysroot,'r');
  72. while(!feof($datei)) 
  73.     {
  74. $zeile = fgets($datei,255);
  75. $sysroot[]=$zeile; 
  76. $i+=1; 
  77.     }
  78. fclose($datei);
  79. list ($left, $right) = split (' = ', $sysroot[0]);
  80. // $right = eregi_replace (" ","",$right);
  81. $right = eregi_replace ("\r\n","",$right);
  82. if (strtolower($partwampp)==strtolower($right))
  83.     {
  84.     $xamppinstaller="nothingtodo";
  85.     }
  86. else
  87.     { 
  88.     $xamppinstaller="newpath";
  89.     $substit = eregi_replace ("\\\\","\\\\\\\\",$right);
  90.     $substitslash = eregi_replace("\\\\","/",$right);
  91.     }
  92. }
  93. else
  94.     $installsys = fopen($installsysroot,'w');
  95.     $wamppinfo = "DIR = $partwampp\r\nxampp = $xamppversion\r\nserver = 0\r\nperl = 0\r\npython = 0\r\nutils = 0\r\njava = 0\r\nother = 0"; 
  96.     fputs($installsys,$wamppinfo); 
  97.     fclose($installsys);
  98.     $xamppinstaller="newinstall"; 
  99. }
  100.  
  101.  
  102. /// Find some *update.sys files and modify the install.sys ...
  103.  
  104. $path=$partwampp."\install\\";
  105. $hdl=opendir($path);
  106. while ($res = readdir ($hdl)) { $array[]=$res; } //Searching all xampp sys files
  107. closedir($hdl); 
  108. $werte=count($array);
  109. for ($q=2; $q<$werte; $q++)
  110. {
  111. if ($array[$q]==$perlupdatesys || $array[$q]==$pythonupdatesys || $array[$q]==$serverupdatesys || $array[$q]==$utilsupdatesys || $array[$q]==$javaupdatesys || $array[$q]==$otherupdatesys)
  112.     {
  113.  
  114. $updatesysroot=$partwampp."\install\\".$array[$q];
  115.  
  116. if (file_exists($updatesysroot)) 
  117. {
  118.     $datei = fopen($updatesysroot,'r');
  119.     unset($updatezeile);
  120.     
  121.     $i=0;
  122.     while(!feof($datei)) 
  123.     {
  124.  
  125.     $zeile = fgets($datei,255);
  126.     $updatezeile[]=$zeile;
  127.     list ($left, $right) = split ('=', $updatezeile[0]);
  128.     // $right = eregi_replace (" ","",$right);
  129.     $left = eregi_replace (" ","",$left);
  130.     $left = eregi_replace ("\r\n","",$left);
  131.     $right = eregi_replace ("\r\n","",$right);        
  132.     $update=$left;
  133.     $update=strtolower($update); 
  134.     $updateversion=$right;
  135.     $updateversionzahl = eregi_replace ("\.","",$updateversion);
  136.     $updateinc="xampp".$update.".inc";
  137.     $updateconf=$update.".conf";
  138.     echo "  Configure for $update $updateversion\r\n";
  139.     $i++;
  140.     }
  141.     fclose($datei);    
  142.  
  143.     if (file_exists($installsysroot)) 
  144.     {
  145.     $datei = fopen($installsysroot,'r');
  146.     unset($newzeile);
  147.     $i=0;
  148.     while(!feof($datei)) 
  149.     {
  150.     $zeile = fgets($datei,255);
  151.     $newzeile[]=$zeile; 
  152.     $i++; 
  153.     }
  154.     fclose($datei);
  155.  
  156.         /// Analyze install.sys to *update.syse for todo     
  157.         $datei = fopen($installsysroot,'w'); 
  158.         if($datei) 
  159.             { 
  160.                 for($z=0;$z<$i+1;$z++) 
  161.                 { 
  162.                     if (eregi($update,$newzeile[$z]))
  163.                     {
  164.                         list ($left, $right) = split ('=', $newzeile[$z]);
  165.                         // $right = eregi_replace (" ","",$right);
  166.                         $left = eregi_replace (" ","",$left);
  167.                         $left = eregi_replace ("\r\n","",$left);
  168.                         $right = eregi_replace ("\r\n","",$right);
  169.                         $currentversionzahl = eregi_replace ("\.","",$right);
  170.                         if ($currentversionzahl == 0 )
  171.                         {
  172.                             $updatemake="makenew"; // New installation
  173.                             $putnew="$update = $updateversion\r\n";
  174.                             fputs($datei, $putnew);
  175.                         }
  176.                         elseif ($currentversionzahl < $updateversionzahl)
  177.                         {
  178.                             $updatemake="update";  // Update installation
  179.                             $putnew="perl = $updateversion\r\n";
  180.                             fputs($datei, $putnew);
  181.                         }
  182.                         else
  183.                         {
  184.                             $updatemake="doppelt"; // Installation is current
  185.                             fputs($datei,$newzeile[$z]); 
  186.                         }
  187.  
  188.                     }
  189.                     else 
  190.                     { 
  191.                     fputs($datei,$newzeile[$z]); 
  192.                     }
  193.                 }
  194.             }
  195.     fclose($datei);
  196.     
  197.     if ($updatemake=="makenew" || $updatemake=="doppelt")
  198.     { 
  199.         include_once("$partwampp\install\\$updateinc"); 
  200.     }
  201.  
  202.     
  203.     }
  204. // httpd.conf modification for Perl, Python or Java (only single)
  205. if ($update=="perl")
  206.     {
  207.     $includehttpdconf="\r\n\r\nInclude conf/perl.conf";
  208.     }
  209.     if ($update=="python")
  210.     {
  211.     $includehttpdconf="\r\n\r\nInclude conf/python.conf";
  212.     }
  213.     if ($update=="java")
  214.     {
  215.     $includehttpdconf="\r\n\r\nInclude conf/java.conf";
  216.     }
  217.     
  218. if (($update=="perl" || $update=="python" || $update=="java") && $updatemake=="makenew")
  219.     {
  220.     $datei = fopen($confhttpdroot,'a'); 
  221.     if($datei) 
  222.             { 
  223.             fputs($datei, $includehttpdconf);
  224.             }
  225.     fclose($datei);    
  226.     $datei = fopen($confhttpd2root,'a'); 
  227.     if($datei) 
  228.             { 
  229.             fputs($datei, $includehttpdconf);
  230.             }
  231.     fclose($datei);
  232.     $datei = fopen($confhttpd3root,'a'); 
  233.     if($datei) 
  234.             { 
  235.             fputs($datei, $includehttpdconf);
  236.             }
  237.     fclose($datei);
  238.     }
  239.  
  240.  
  241. unlink ($updatesysroot);
  242. }
  243. }
  244.  
  245.  
  246.  
  247.  
  248. if ($xamppinstaller=="newinstall" || $xamppinstaller=="newpath")
  249. {
  250. if ($xamppinstaller=="newinstall")
  251.     {
  252.     /// First initialization only main packages 
  253.     if (file_exists("$partwampp\install\\xamppbasic.inc")) 
  254.         { include_once("$partwampp\install\\xamppbasic.inc"); }
  255.  
  256.     }
  257.     
  258.     else
  259.     {
  260. /// Find all the packages 
  261. if (file_exists("$partwampp\install\\xamppbasic.inc")) 
  262. { include_once("$partwampp\install\\xamppbasic.inc"); }
  263. if (file_exists("$partwampp\install\\xamppserver.inc")) 
  264. { include_once("$partwampp\install\\xamppserver.inc"); }
  265. if (file_exists("$partwampp\install\\xamppperl.inc")) 
  266. { include_once("$partwampp\install\\xamppperl.inc"); }
  267. if (file_exists("$partwampp\install\\xampppython.inc")) 
  268. { include_once("$partwampp\install\\xampppython.inc"); }
  269. if (file_exists("$partwampp\install\\xampputils.inc")) 
  270. { include_once("$partwampp\install\\xampputils.inc"); }
  271. if (file_exists("$partwampp\install\\xamppjava.inc")) 
  272. { include_once("$partwampp\install\\xamppjava.inc"); }
  273. if (file_exists("$partwampp\install\\xamppother.inc")) 
  274. { include_once("$partwampp\install\\xamppother.inc"); }
  275. $updatemake="nothingtodo";
  276.     }
  277. }
  278.  
  279. $scount=count($slash);
  280. $bcount=count($backslash);
  281.  
  282. /////////////////// xampp path is changing ///////////////////
  283. if ($xamppinstaller=="newpath")
  284. {
  285. set_time_limit(0);
  286. define('STDIN',fopen("php://stdin","r"));
  287.     while($BS == "0")
  288.     {
  289.     echo "\n  Do you want to refresh the XAMPP installation?\n";
  290.     echo "  Soll die XAMPP Installation jetzt aktualisiert werden?\n\n";
  291.     echo "  1) Refresh now! (Jetzt aktualisieren!)\n";
  292.     echo "  x) Exit (Beenden)\n";
  293.  
  294.         switch(trim(fgets(STDIN,256)))
  295.         {
  296.         case 1:
  297.         $BS = 1;
  298.         echo "\r\n  XAMPP is refreshing now ...\r\n";
  299.         echo "  XAMPP wird nun aktualisiert ...\r\n\r\n";
  300.         sleep(1);
  301.         break;
  302.  
  303.         case "x":
  304.         echo "\r\n  The refresh is terminating on demand ...  exit\r\n";
  305.         echo "  Die Aktualisierung wurde auf Wunsch abgebrochen ...\r\n";
  306.         sleep(3);
  307.         exit();
  308.  
  309.         default: 
  310.         exit();
  311.         }
  312.     }
  313. fclose(STDIN);
  314. }
  315.  
  316. /////////////////// You can configure the addon modules for httpd ///////////////////
  317. if (file_exists($installsysroot)) 
  318.     {
  319.     $datei = fopen($installsysroot,'r');
  320.     unset($newzeile);
  321.     $i=0;
  322.         while(!feof($datei)) 
  323.         {
  324.         $zeile = fgets($datei,255);
  325.         list ($left, $right) = split ('=', $zeile);
  326.         // $right = eregi_replace (" ","",$right);
  327.         $left = eregi_replace (" ","",$left);
  328.         $left = eregi_replace ("\r\n","",$left);
  329.         $right = eregi_replace ("\r\n","",$right);
  330.         $right = eregi_replace ("\.","",$right);
  331.         if (strtolower($right) > 0)
  332.             {
  333.             if (strtolower($left)=="perl")
  334.                 {
  335.                 $perlactive="yes";
  336.                 
  337.                 }
  338.                 if (strtolower($left)=="python")
  339.                 {
  340.                 $pythonactive="yes";
  341.                 }
  342.                 if (strtolower($left)=="java")
  343.                 {
  344.                 $javaactive="yes";
  345.                 }
  346.             } 
  347.         }
  348. fclose($datei);
  349.     }
  350.  
  351.  
  352.  
  353.  
  354. /////////////////// Case new install ///////////////////
  355. if ($xamppinstaller=="newinstall" || $BS==1 || $updatemake=="makenew" || $updatemake=="doppelt")
  356. {
  357.  
  358. if ($BS=="1")
  359. { echo "  Refreshing all paths in config files ... \r\n\r\n";  }
  360.  
  361. echo "  Configure XAMPP with awk for ";
  362. $system = system ("echo '%os%'");
  363. if ($system!="'Windows_NT'")
  364. {$system = "Windows"; echo "  $system 98/ME/HOME (not NT)";} 
  365. echo "  Please wait ...";
  366. if ($xamppinstaller=="newinstall")
  367. {
  368. if ($system=="Windows")
  369. {
  370.     $confhttpdroot=$partwampp."\apache\\conf\\httpd.conf";
  371.     $includewin="Win32DisableAcceptEx ON\r\n";
  372.     echo "\r\n  Disable AcceptEx Winsocks v2 support (only NT)";
  373.     $datei = fopen($confhttpdroot,'r');
  374.     unset($newzeile);
  375.     $i=0;
  376.     while(!feof($datei)) 
  377.     {
  378.     $zeile = fgets($datei,255);
  379.     $newzeile[]=$zeile; 
  380.     $i++; 
  381.     }
  382.     fclose($datei);
  383.      $datei = fopen($confhttpdroot,'w'); 
  384.         if($datei) 
  385.             { 
  386.                 for($z=0;$z<$i+1;$z++) 
  387.                 { 
  388.                     if (eregi("Win32DisableAcceptEx",$newzeile[$z]))
  389.                     {
  390.                         fputs($datei, $includewin);
  391.                     }
  392.                     else 
  393.                     { 
  394.                     fputs($datei,$newzeile[$z]); 
  395.                     }
  396.                 }
  397.             }
  398.     fclose($datei);
  399.  
  400.     $confhttpdroot=$partwampp."\php\\php4\\httpd4.conf";
  401.     if (file_exists($confhttpdroot))
  402.     {
  403.     $includewin="Win32DisableAcceptEx ON\r\n";
  404.     $datei = fopen($confhttpdroot,'r');
  405.     unset($newzeile);
  406.     $i=0;
  407.     while(!feof($datei)) 
  408.     {
  409.     $zeile = fgets($datei,255);
  410.     $newzeile[]=$zeile; 
  411.     $i++; 
  412.     }
  413.     fclose($datei);
  414.      $datei = fopen($confhttpdroot,'w'); 
  415.         if($datei) 
  416.             { 
  417.                 for($z=0;$z<$i+1;$z++) 
  418.                 { 
  419.                     if (eregi("Win32DisableAcceptEx",$newzeile[$z]))
  420.                     {
  421.                         fputs($datei, $includewin);
  422.                     }
  423.                     else 
  424.                     { 
  425.                     fputs($datei,$newzeile[$z]); 
  426.                     }
  427.                 }
  428.             }
  429.     fclose($datei);
  430.     }
  431.     $confhttpdroot=$partwampp."\php\\httpd5.conf";
  432.     if (file_exists($confhttpdroot))
  433.     {
  434.     $includewin="Win32DisableAcceptEx ON\r\n";
  435.     $datei = fopen($confhttpdroot,'r');
  436.     unset($newzeile);
  437.     $i=0;
  438.     while(!feof($datei)) 
  439.     {
  440.     $zeile = fgets($datei,255);
  441.     $newzeile[]=$zeile; 
  442.     $i++; 
  443.     }
  444.     fclose($datei);
  445.      $datei = fopen($confhttpdroot,'w'); 
  446.         if($datei) 
  447.             { 
  448.                 for($z=0;$z<$i+1;$z++) 
  449.                 { 
  450.                     if (eregi("Win32DisableAcceptEx",$newzeile[$z]))
  451.                     {
  452.                         fputs($datei, $includewin);
  453.                     }
  454.                     else 
  455.                     { 
  456.                     fputs($datei,$newzeile[$z]); 
  457.                     }
  458.                 }
  459.             }
  460.     fclose($datei);
  461.     }
  462. }
  463. else
  464. {
  465.     $confhttpdroot=$partwampp."\apache\\conf\\httpd.conf";
  466.     $includewin="# Win32DisableAcceptEx ON\r\n";
  467.     echo "\r\n  Enable AcceptEx Winsocks v2 support for NT systems";
  468.     $datei = fopen($confhttpdroot,'r');
  469.     $i=0;
  470.     unset($newzeile);
  471.     while(!feof($datei)) 
  472.     {
  473.     $zeile = fgets($datei,255);
  474.     $newzeile[]=$zeile; 
  475.     $i++; 
  476.     }
  477.     fclose($datei);
  478.      $datei = fopen($confhttpdroot,'w'); 
  479.         if($datei) 
  480.             { 
  481.                 for($z=0;$z<$i+1;$z++) 
  482.                 { 
  483.                     if (eregi("Win32DisableAcceptEx",$newzeile[$z]))
  484.                     {
  485.                         fputs($datei, $includewin);
  486.                     }
  487.                     else 
  488.                     { 
  489.                     fputs($datei,$newzeile[$z]); 
  490.                     }
  491.                 }
  492.             }
  493.     fclose($datei);
  494.  
  495.     $confhttpdroot=$partwampp."\php\\php4\\httpd4.conf";
  496.     if (file_exists($confhttpdroot))
  497.     {
  498.     $includewin="# Win32DisableAcceptEx ON\r\n";
  499.     $datei = fopen($confhttpdroot,'r');
  500.     $i=0;
  501.     unset($newzeile);
  502.     while(!feof($datei)) 
  503.     {
  504.     $zeile = fgets($datei,255);
  505.     $newzeile[]=$zeile; 
  506.     $i++; 
  507.     }
  508.     fclose($datei);
  509.      $datei = fopen($confhttpdroot,'w'); 
  510.         if($datei) 
  511.             { 
  512.                 for($z=0;$z<$i+1;$z++) 
  513.                 { 
  514.                     if (eregi("Win32DisableAcceptEx",$newzeile[$z]))
  515.                     {
  516.                         fputs($datei, $includewin);
  517.                     }
  518.                     else 
  519.                     { 
  520.                     fputs($datei,$newzeile[$z]); 
  521.                     }
  522.                 }
  523.             }
  524.     fclose($datei);
  525.     }
  526.     $confhttpdroot=$partwampp."\php\\httpd5.conf";
  527.     if (file_exists($confhttpdroot))
  528.     {
  529.     $includewin="# Win32DisableAcceptEx ON\r\n";
  530.     $datei = fopen($confhttpdroot,'r');
  531.     $i=0;
  532.     unset($newzeile);
  533.     while(!feof($datei)) 
  534.     {
  535.     $zeile = fgets($datei,255);
  536.     $newzeile[]=$zeile; 
  537.     $i++; 
  538.     }
  539.     fclose($datei);
  540.      $datei = fopen($confhttpdroot,'w'); 
  541.         if($datei) 
  542.             { 
  543.                 for($z=0;$z<$i+1;$z++) 
  544.                 { 
  545.                     if (eregi("Win32DisableAcceptEx",$newzeile[$z]))
  546.                     {
  547.                         fputs($datei, $includewin);
  548.                     }
  549.                     else 
  550.                     { 
  551.                     fputs($datei,$newzeile[$z]); 
  552.                     }
  553.                 }
  554.             }
  555.     fclose($datei);
  556.     }
  557. }
  558. }
  559. $substit="\"".$substit."\"";
  560. for ($i=1;$i<=$bcount;$i++)
  561. {
  562.  
  563.  
  564.  
  565.  
  566. $temp=$backslash[$i];
  567. $awkconfig=$backslashrootawk[$temp].$backslash[$i]."\"";
  568. $awkconfigtemp=$backslashrootawk[$temp].$backslash[$i]."temp\"";
  569. $configreal=$backslashrootreal[$temp].$backslash[$i];
  570. $configtemp=$backslashrootreal[$temp].$backslash[$i]."temp";
  571.  
  572.  
  573. ///////////// Section SET  NEW configfiles for addons/update OR DELETE /////////////
  574. $configrealnew=$backslashrootreal[$temp].$backslash[$i].".new";
  575. if (!file_exists($configreal) && file_exists($configrealnew))
  576.     { 
  577.             
  578.             if (!@copy($configrealnew, $configreal)) 
  579.                 {}            
  580.             else { unlink ($configrealnew); }
  581.         
  582.     }
  583.     elseif (file_exists($configrealnew))
  584.     { unlink ($configrealnew); }
  585.  
  586. if ($updatemake=="doppelt")
  587.     { break; }
  588.  
  589.  
  590. $awkrealm=$awkexe." -v DIR=".$awknewdir." -v CONFIG=".$awkconfig. " -v CONFIGNEW=".$awkconfigtemp. "  -v SUBSTIT=".$substit." -f ".$awk;  
  591.  
  592.  
  593.  
  594. if (file_exists($awk) && file_exists($awkexe) && file_exists($configreal)) 
  595. {        
  596.     shell_exec("$awkrealm");
  597.  
  598.     if (file_exists($configtemp) && file_exists($configreal))
  599.     {
  600.     if (!@copy($configtemp, $configreal)) 
  601.         {
  602.         // echo "\r\n\r\n$configtemp could not be copied to $configreal";
  603.         }
  604.         else { unlink ($configtemp); }
  605.     } 
  606. }
  607.  
  608.  
  609. $substitslash="\"".$substitslash."\"";
  610. for ($i=1;$i<=$scount;$i++)
  611. {
  612. $temp=$slash[$i];
  613. $awkconfig=$slashrootawk[$temp].$slash[$i]."\"";
  614. $awkconfigtemp=$slashrootawk[$temp].$slash[$i]."temp\"";
  615. $configreal=$slashrootreal[$temp].$slash[$i];
  616. $configtemp=$slashrootreal[$temp].$slash[$i]."temp";
  617.  
  618. ///////////// Section SET  NEW configfiles for addons/update OR DELETE /////////////
  619. $configrealnew=$slashrootreal[$temp].$slash[$i].".new";
  620. if (!file_exists($configreal) && file_exists($configrealnew))
  621.     { 
  622.             
  623.             if (!@copy($configrealnew, $configreal)) 
  624.                 {}            
  625.             else { unlink ($configrealnew); }
  626.         
  627.     }
  628.     elseif (file_exists($configrealnew))
  629.     { unlink ($configrealnew); }
  630.  
  631.     if ($updatemake=="doppelt")
  632.     { break; }
  633.  
  634. $awkrealm=$awkexe." -v DIR=".$awkslashdir." -v CONFIG=".$awkconfig. " -v CONFIGNEW=".$awkconfigtemp. "  -v SUBSTIT=".$substitslash." -f ".$awk;  
  635.  
  636.  
  637. if (file_exists($awk) && file_exists($awkexe) && file_exists($configreal)) 
  638. {
  639.     shell_exec("$awkrealm");
  640.  
  641.     if (file_exists($configtemp) && file_exists($configreal))
  642.     {
  643.     if (!@copy($configtemp, $configreal)) 
  644.         {
  645.         // echo "\r\n\r\n$configtemp could not be copied to $configreal";
  646.         }
  647.         else { unlink ($configtemp); }
  648.     } 
  649. }
  650.  
  651.  
  652.     
  653.     if ($xamppinstaller=="newpath" || $BS==1)
  654.     {
  655.         if (file_exists($installsysroot)) 
  656.         {
  657.         $datei = fopen($installsysroot,'r');
  658.         unset($newzeile);
  659.         $i=0;
  660.         while(!feof($datei)) 
  661.         {
  662.         $zeile = fgets($datei,255);
  663.         $newzeile[]=$zeile; 
  664.         $i++; 
  665.         }
  666.         fclose($datei);
  667.         }
  668.         
  669.         $datei = fopen($installsysroot,'w'); 
  670.         if($datei) 
  671.             { 
  672.                 for($z=0;$z<$i+1;$z++) 
  673.                 { 
  674.                     if (eregi("DIR",$newzeile[$z]))
  675.                     {
  676.                         $includenewdir="DIR = $partwampp\r\n";
  677.                         fputs($datei, $includenewdir);
  678.                     }
  679.                     else 
  680.                     { 
  681.                     $includenewdir=$newzeile[$z];
  682.                     fputs($datei, $includenewdir); 
  683.                     }
  684.                 }
  685.             }
  686.             fclose($datei);
  687.     }
  688.  
  689. ////////// Replace (copy) some newer files ////////////////
  690.     $phpbin=$partwampp."\apache\bin\php.ini";
  691.     $phpcgi=$partwampp."\php\php.ini";
  692.     $workersbin=$partwampp."\\tomcat\\conf\workers.properties";
  693.     $workersjk=$partwampp."\\tomcat\\conf\jk\workers.properties";
  694.         if (file_exists($phpbin)) 
  695.         {
  696.         copy($phpbin,$phpcgi);
  697.         }
  698.         if (file_exists($workersbin)) 
  699.         {
  700.         copy($workersbin,$workersjk);
  701.         }
  702.  
  703.     echo "  DONE!\r\n\r\n";
  704. echo "\r\n  ##### Have fun with ApacheFriends XAMPP! #####\r\n\r\n\r\n";
  705. sleep(3);
  706. exit();
  707. }
  708.  
  709.  
  710.  
  711. //////////////// Selection for modules  ////////////////
  712. if (($perlactive=="yes" || $pythonactive=="yes" || $javaactive=="yes") && $update=="")
  713. {
  714. $u=1;
  715.  
  716. if ($perlactive=="yes")
  717.     {
  718.     $moduleconf="conf/perl.conf";
  719.     $moduleconfigure="MOD_PERL";
  720.     $u++;
  721.     }
  722. if ($pythonactive=="yes")
  723.     {
  724.     $moduleconf="conf/pyton.conf";
  725.     $moduleconfigure="MOD_PYTHON";
  726.     $u++;
  727.     }
  728. if ($javaactive=="yes")
  729.     {
  730.     $moduleconf="conf/java.conf";
  731.     $moduleconfigure="MOD_JDK";
  732.     $u++;
  733.     }
  734.  
  735. set_time_limit(0);
  736. define('NEWSTDIN',fopen("php://stdin","r"));
  737. while($CS == "0")
  738. {
  739. echo "\n  Please select your choice!\n";
  740. echo "  Bitte jetzt auswaehlen!\n\n";
  741. if ($perlactive=="yes")
  742.     {
  743.     echo "  1) Configuration with MOD_PERL (mit MOD_PERL)\n";
  744.     echo "  2) Configuration without MOD_PERL (ohne MOD MOD_PERL)\n";
  745.     }
  746.     if ($pythonactive=="yes")
  747.     {
  748.     echo "  3) Configuration with MOD_PYTHON (mit MOD_PYTHON)\n";
  749.     echo "  4) Configuration without MOD_PYTHON (ohne MOD_PYTHON)\n";
  750.     }
  751.     if ($javaactive=="yes")
  752.     {
  753.     echo "  5) Configuration with MOD_JDK (mit MOD_JDK)\n";
  754.     echo "  6) Configuration without MOD_JDK (ohne MOD_JDK)\n";
  755.     }
  756.     echo "  x) Exit (Beenden)\n";
  757.  
  758. switch(trim(fgets(NEWSTDIN,256)))
  759. {
  760. case 1:
  761. $CS = 1;
  762. echo "\r\n  Starting configure XAMPP with MOD_PERL ...\r\n";
  763. sleep(1);
  764. break;
  765.  
  766. case 2:
  767. $CS = 2;
  768. echo "\r\n  Starting configure XAMPP without MOD_PERL ...\r\n";
  769. sleep(1);
  770. break;
  771.  
  772. case 3:
  773. $CS = 3;
  774. echo "\r\n  Starting configure XAMPP with MOD_PYTHON ...\r\n";
  775. sleep(1);
  776. break;
  777.  
  778. case 4:
  779. $CS = 4;
  780. echo "\r\n  Starting configure XAMPP without MOD_PYTHON ...\r\n";
  781. sleep(1);
  782. break;
  783.  
  784. case 5:
  785. $CS = 5;
  786. echo "\r\n  Starting configure XAMPP with MOD_JDK ...\r\n";
  787. sleep(1);
  788. break;
  789.  
  790. case 6:
  791. $CS = 6;
  792. echo "\r\n  Starting configure XAMPP without MOD_JDK ...\r\n";
  793. sleep(1);
  794. break;
  795.  
  796. case "x":
  797. echo "\r\n  Setup is terminating on demand ...  exit\r\n";
  798. echo "  Das Setup wurde auf Wunsch abgebrochen ...\r\n";
  799. sleep(3);
  800. exit();
  801.  
  802. default: 
  803. exit();
  804. }
  805. }
  806. fclose(NEWSTDIN);
  807.  
  808. if ($CS == 1)
  809.     { $include = "Include conf/perl.conf"; $searchstring="conf/perl.conf";}
  810. if ($CS == 2)
  811.     { $include = "# Include conf/perl.conf"; $searchstring="conf/perl.conf";}
  812. if ($CS == 3)
  813.     { $include = "Include conf/python.conf"; $searchstring="conf/python.conf"; }
  814. if ($CS == 4)
  815.     { $include = "# Include conf/python.conf"; $searchstring="conf/python.conf";}
  816. if ($CS == 5)
  817.     { $include = "Include conf/java.conf"; $searchstring="conf/java.conf";}
  818. if ($CS == 6)
  819.     { $include = "# Include conf/java.conf"; $searchstring="conf/java.conf";}
  820.  
  821.  
  822.  
  823.  
  824. if ($CS > 0)
  825. {    
  826.     $i=0;    
  827.     $datei = fopen($confhttpdroot,'r');
  828.     while(!feof($datei)) 
  829.     {
  830.     $zeile = fgets($datei,255);
  831.     $newzeile[]=$zeile; 
  832.     $i++; 
  833.     }
  834.     fclose($datei);
  835.      $datei = fopen($confhttpdroot,'w'); 
  836.         if($datei) 
  837.             { 
  838.                 for($z=0;$z<$i+1;$z++) 
  839.                 { 
  840.                     if (eregi($searchstring,$newzeile[$z]))
  841.                     {
  842.                         fputs($datei, $include);
  843.                     }
  844.                     else 
  845.                     { 
  846.                     fputs($datei,$newzeile[$z]); 
  847.                     }
  848.                 }
  849.             }
  850.     fclose($datei);
  851.     unset ($newzeile);
  852.     $i=0;    
  853.     $datei = fopen($confhttpd2root,'r');
  854.     while(!feof($datei)) 
  855.     {
  856.     $zeile = fgets($datei,255);
  857.     $newzeile[]=$zeile; 
  858.     $i++; 
  859.     }
  860.     fclose($datei);
  861.      $datei = fopen($confhttpd2root,'w'); 
  862.         if($datei) 
  863.             { 
  864.                 for($z=0;$z<$i+1;$z++) 
  865.                 { 
  866.                     if (eregi($searchstring,$newzeile[$z]))
  867.                     {
  868.                         fputs($datei, $include);
  869.                     }
  870.                     else 
  871.                     { 
  872.                     fputs($datei,$newzeile[$z]); 
  873.                     }
  874.                 }
  875.             }
  876.     fclose($datei);
  877.     unset ($newzeile);
  878.     $i=0;    
  879.     $datei = fopen($confhttpd3root,'r');
  880.     while(!feof($datei)) 
  881.     {
  882.     $zeile = fgets($datei,255);
  883.     $newzeile[]=$zeile; 
  884.     $i++; 
  885.     }
  886.     fclose($datei);
  887.      $datei = fopen($confhttpd3root,'w'); 
  888.         if($datei) 
  889.             { 
  890.                 for($z=0;$z<$i+1;$z++) 
  891.                 { 
  892.                     if (eregi($searchstring,$newzeile[$z]))
  893.                     {
  894.                         fputs($datei, $include);
  895.                     }
  896.                     else 
  897.                     { 
  898.                     fputs($datei,$newzeile[$z]); 
  899.                     }
  900.                 }
  901.             }
  902.     fclose($datei);
  903.     unset ($newzeile);
  904.     echo "  Done!\r\n\r\n";    
  905.  
  906.  
  907.  
  908. }
  909.  
  910.  
  911. }
  912.  
  913. if ($updatemake=="")
  914.         {  $updatemake="nothingtodo"; }
  915.  
  916. if ($updatemake=="nothingtodo" && $xamppinstaller=="nothingtodo" && ($CS < 1 || $CS == ""))
  917. { echo "\r\n\r\n Sorry, but ... nothing to do!\r\n\r\n\r\n";  }
  918.  
  919.  
  920. exit();
  921. ?>
  922.